Stochastic Differential Equation (SDE)
A Stochastic Differential Equation (SDE) is a differential equation in which one or more terms is a stochastic process, resulting in a solution that is itself a stochastic process. SDEs are used to model systems with random fluctuations and are fundamental to [[Diffusion Model|Diffusion Models]], financial mathematics, and physics.
1. Core Concept
1.1 From ODE to SDE
Ordinary Differential Equation (ODE):
Stochastic Differential Equation (SDE):
The key difference is the addition of the stochastic term
[!NOTE] Key Insight
While ODEs describe deterministic evolution, SDEs incorporate random noise, making them suitable for modeling real-world systems with uncertainty.
1.2 Components of SDE
| Component | Notation | Role |
|---|---|---|
| Drift coefficient |
|
Deterministic trend |
| Diffusion coefficient |
|
Noise intensity |
| **[[Wiener Process | Wiener Process]]** |
|
| State variable |
|
System state |
2. Mathematical Foundation
2.1 Itô Interpretation
The SDE is interpreted as an integral equation:
where the second integral is an [[Itô Integral|Itô integral]].
2.2 Itô’s Lemma
Theorem: For an Itô process:
and a twice-differentiable function
[!WARNING] Itô vs Stratonovich
The extra termis unique to Itô calculus and arises from the non-zero quadratic variation of [[Wiener Process|Wiener process]]. This term does not appear in classical calculus.
2.3 Itô’s Lemma in Multiple Dimensions
For
and function
3. Common Types of SDEs
3.1 Linear SDE
Solution method: Use integrating factor or variation of constants.
3.2 Geometric [[Wiener Process|Brownian Motion]]
Solution (using Itô’s Lemma on
Application: Stock price modeling (Black-Scholes).
3.3 Ornstein-Uhlenbeck Process
Solution:
Properties:
- Mean-reverting to zero
- Stationary distribution:
- Used in interest rate models (Vasicek model)
3.4 Variance-Preserving SDE (VP-SDE)
Properties:
- Marginal distribution:
- Preserves variance in
- Primary choice for [[Diffusion Model|Diffusion Models]]
3.5 Variance-Exploding SDE (VE-SDE)
Properties:
- Variance grows with time:
- No drift term
- Alternative formulation for diffusion models
4. Solving SDEs
4.1 Analytical Solutions
Some SDEs have closed-form solutions:
| SDE | Solution | Method |
|---|---|---|
|
|
|
Direct integration |
|
|
|
Itô’s Lemma |
|
|
|
Integrating factor |
4.2 Numerical Methods
Euler-Maruyama Method
Simplest discretization:
Convergence: Strong order 0.5, weak order 1.0
Milstein Method
Higher-order method:
Convergence: Strong order 1.0
1 | # Pseudocode: Euler-Maruyama Method |
5. Fokker-Planck Equation
5.1 Forward Kolmogorov Equation
The probability density
This is the Fokker-Planck equation (or forward Kolmogorov equation).
5.2 Stationary Distribution
For time-homogeneous SDE
Solution (for
5.3 Connection to [[Probability Flow ODE|Probability Flow ODE]]
The Fokker-Planck equation can be written as a continuity equation:
where the velocity field
6. SDEs in Diffusion Models
6.1 Forward Process
In diffusion models, data
Common choices:
| SDE Type |
|
|
Marginal |
|---|---|---|---|
| VP-SDE |
|
|
|
| VE-SDE |
|
|
|
| Sub-Variance |
|
|
Interpolates between VP and VE |
6.2 Reverse Process
The time-reversal of an SDE (Anderson, 1982):
where:
-
is reverse-time [[Wiener Process|Wiener process]] -
is the [[Score Function|score function]] - Must be solved backward from
to
6.3 Score Matching
Learn the score function with neural network
Objective:
For VP-SDE:
7. Beyond SDE: ODE Equivalence and Fast Sampling
7.1 From SDE to [[Probability Flow ODE]]
The reverse SDE can be deterministically transformed into an ODE with identical marginals:
This [[Probability Flow ODE]] enables:
- Deterministic sampling (same noise → same output)
- Exact likelihood computation via instantaneous change of variables
- Inversion of real data to latent space
7.2 Fast SDE Sampling Methods
| Method | Type | Steps | Key Idea |
|---|---|---|---|
| DDPM | SDE | 1000 | Original Markov chain |
| [[DDIM]] | Non-Markovian | 50-100 | Relaxes Markov assumption |
| [[DPM-Solver]] | ODE | 10-20 | Semi-linear structure exploitation |
| Predictor-Corrector | SDE+ODE | 20-50 | Langevin refinement steps |
7.3 Numerical Stability in SDE Solvers
Key challenges for diffusion model SDEs:
-
Stiffness near
: VP-SDE becomes very stiff- Fix: Non-uniform time discretization, more steps near
- Fix: Non-uniform time discretization, more steps near
-
Score function explosion: As
, the score diverges- Fix: Use
-prediction instead of direct score prediction
- Fix: Use
-
Discretization error accumulation: Euler-Maruyama error propagates
- Fix: Higher-order methods (Milstein, [[DPM-Solver]])
-
SDE vs ODE trade-off:
- SDE: Better quality (injecting fresh noise), slower
- ODE: Faster, deterministic, better for inversion
8. Existence and Uniqueness
8.1 Lipschitz Conditions
Theorem: If
- Lipschitz condition:
- Linear growth:
then the SDE has a unique strong solution.
8.2 Weak vs Strong Solutions
| Type | Definition | Requirement |
|---|---|---|
| Strong solution |
|
Fixed probability space |
| Weak solution | Existence of
|
Distribution equivalence |
9. Girsanov Theorem
9.1 Change of Measure
Theorem: Under suitable conditions, we can change measure
If
where
9.2 Applications
- Risk-neutral pricing in finance
- Importance sampling for variance reduction
- Likelihood ratio computation in diffusion models
10. Core Formula Cards
[!QUOTE] General SDE
[!QUOTE] Itô’s Lemma
[!QUOTE] Geometric [[Wiener Process|Brownian Motion]]
[!QUOTE] Ornstein-Uhlenbeck Process
[!QUOTE] VP-SDE (Diffusion Models)
[!QUOTE] Reverse-Time SDE
[!QUOTE] Fokker-Planck Equation
[!QUOTE] Euler-Maruyama Discretization
Related Concepts
- [[Wiener Process|Wiener Process]]
- [[Itô Integral]]
- [[Itô’s Lemma]]
- [[Martingale]]
- [[Diffusion Model]]
- [[Probability Flow ODE]]
- [[Score Function]]
- [[DDIM]]
- [[DPM-Solver]]
- [[Flow Matching]]
- [[Markov Process]]
- [[Fokker-Planck Equation]]
- [[Kolmogorov Equations]]
- [[Langevin Dynamics]]
- [[Stochastic Process]]
- [[Brownian Motion]]
Dataview Query
1 | LIST |
References
- Book: Stochastic Differential Equations - Bernt Øksendal
- Book: [[Wiener Process|Brownian Motion]] and Stochastic Calculus - Karatzas & Shreve
- Paper: Score-Based Generative Modeling through SDEs (Song et al., 2021)
- Paper: Maximum Likelihood Training of Score-Based Diffusion Models (Song et al., 2021)
- Course: MIT 18.S096 Topics in Mathematics with Applications in Finance
- Course: CS236 Deep Generative Models (Stanford)